import { Get, Post } from "@/library/utils/request"
import * as types from "@/views/shop_manager/shop_list/types"
import { ResponseWithCount } from "@/library/common/types"

export const ShopListApiUrl = {
    Select: "/Shop/SelectShop",
    Insert: "/Shop/InsertShop",
    Update: "/Shop/UpdateShop",
    Delete: "/Shop/DeleteById",
    Params: "/Shop/Params",
    BindManager: "/Shop/BindManagerToShop",
    UpdateManager: "/Shop/UpdateManagerOfShop",
    UnbindManager: "/Shop/UnbindManagerOfShop",
}

export const ShopListApi = {
    /**
     * 查询
     */
    Select(params: types.SelectParamsType) {
        return Post<ResponseWithCount<types.DataType[]>>(ShopListApiUrl.Select, params)
    },
    /**
     * 新增
     */
    Insert(params: types.InsertType) {
        return Post(ShopListApiUrl.Insert, params)
    },
    /**
     * 更新
     */
    Update(params: types.UpdateType) {
        return Post(ShopListApiUrl.Update, params)
    },
    /**
     * 删除
     */
    Delete(params: types.DeleteType) {
        return Post(ShopListApiUrl.Delete, params)
    },
    /**
     * 获取下拉参数
     */
    Params() {
        return Get<types.ParamsType>(ShopListApiUrl.Params)
    },
    /**
     * 绑定门店管理员
     */
    BindManager(params: types.BindManagerType) {
        return Post(ShopListApiUrl.BindManager, params)
    },
    /**
     * 门店更换绑定管理员
     */
    UpdateManager(params: types.BindManagerType) {
        return Post(ShopListApiUrl.UpdateManager, params)
    },
    /**
     * 解绑管理员
     */
    UnbindManager(params: types.UnbindManagerType) {
        return Post(ShopListApiUrl.UnbindManager, params)
    },
}